<template>
	<view>
		<view class="page">
			<comp-common v-bind="{data:data}" @getUserInfo="getUserInfo" @myLogin="myLogin" @getPhoneNumber="getPhoneNumber"
			 @hideGetCoupon="hideGetCoupon" @closeCouponBox="closeCouponBox" @navigatorClick="navigatorClick"></comp-common>
			<comp-header v-bind="{data:data}" @relevanceError="relevanceError" @relevanceSuccess="relevanceSuccess"></comp-header>
			<view class="body after-navber">
				<view style="margin-top: 20upx;">
					<navigator class="cell flex-row flex-y-center" url="/pages/user-edit/user-edit?type=1">
						<text class="label">昵称</text>
						<view class="right flex-grow-1 flex-row flex-y-center">
							<text>{{data.info.nickname}}</text>
							<image class="icon" :src="data.__wxapp_img.balance.right.url" mode="aspectFit"></image>
						</view>
						<view class="line"></view>
					</navigator>
					<navigator class="cell flex-row flex-y-center" url="/pages/user-edit/user-edit?type=2">
						<text class="label">真实姓名</text>
						<view class="right flex-grow-1 flex-row flex-y-center">
							<text>{{data.info.real_name}}</text>
							<image class="icon" :src="data.__wxapp_img.balance.right.url" mode="aspectFit"></image>
						</view>
						<view class="line"></view>
					</navigator>
					<navigator class="cell flex-row flex-y-center" url="/pages/user-edit/user-edit?type=2">
						<text class="label">身份证号码</text>
						<view class="right flex-grow-1 flex-row flex-y-center">
							<text>{{data.info.id_card}}</text>
							<image class="icon" :src="data.__wxapp_img.balance.right.url" mode="aspectFit"></image>
						</view>
					</navigator>
					<view class="login-out">
						<button type="warn" @tap="loginOut">退出登录</button>
					</view>
				</view>
			</view>
			<comp-footer v-bind="{data:data}"></comp-footer>
		</view>
	</view>
</template>

<script>
	var myVue = {};
	export default {
		data() {
			return {
				data: {
					info: {}
				}
			};
		},
		onLoad: function(t) {
			myVue = this;
			myVue.getApp.page.onLoad(this, t);
		},
		onShow: function() {
			myVue.getApp.page.onShow(this);
			this.getInfo()
		},
		methods: {
			getInfo: function() {
				myVue.getApp.request({
					url: myVue.getApp.api.new.get_user_info,
					success: function(res) {
						res.code == 0 && myVue.setData({
							info: res.data
						})
					}
				})
			},
			loginOut: function() {
				myVue.getApp.core.showActionSheet({
					itemList: ["退出登录"],
					success: function(e) {
						if (0 === e.tapIndex) {
							myVue.getApp.core.clearStorageSync(),myVue.getApp.getDappData();
							myVue.getApp.core.reLaunch({
								url: '/pages/h5-login/h5-login'
							});
						}
					}
				});
			},
		}
	}
</script>

<style scoped>
	.cell {
		width: 100%;
		height: 100upx;
		background-color: #FFFFFF;
		padding: 0 30upx;
		justify-content: space-between;
		position: relative;
	}

	.cell .label {
		font-size: 32upx;
		color: #333333;
	}

	.cell .right {
		justify-content: flex-end;
	}

	.cell .right text {
		font-size: 24upx;
		color: #999999;
		margin-right: 10upx;
	}

	.cell .icon {
		width: 20upx;
		height: 20upx;
	}

	.cell .line {
		width: 690upx;
		height: 2upx;
		background-color: #EEEEEE;
		position: absolute;
		left: 30upx;
		bottom: 0;
	}
	.login-out{
		width: 750upx;
		padding: 30upx;
		box-sizing: border-box;
	}
</style>
